$(function () {
    // 页面顶部 当前周
    $.ajax({
        url: baseloaction + '/mobile/uc/ajax/findLiveTime',
        dataType: 'json',
        type: 'post',
        success: function (response) {
            if (response.success) {
                initCurrentWeek(response.entity);
            }
        },
        error: function () {
        }
    })
});

// 页面顶部 当前周
function initCurrentWeek(list_map) {
    var one = 8.64e7;
    var today = new Date();
    var day = today.getDay() == 0 ? 7 : today.getDay();
    var start = today.getTime();
    if (day != 1) {
        start = start - (day - 1) * one;
    }
    for (var i = 0; i < 7; i++) {
        var now = new Date(start + i * one);
        var dTxt = '';
        if(list_map.indexOf(dateFormat("YYYY-mm-dd",now)) > -1){
            dTxt = '<small class="keTips">课</small>';
        }
        var $li = $('<li class="picker-calendar-day" data-date="' + now.toLocaleDateString() + '"><span>' + (now.getDate()) + '</span> '+ dTxt +'</li>');
        $('ul.lecture-date-num').append($li);
        if (now.getTime() == today.getTime()) {
            $li.addClass('active');
        }
    }
}